<%--
  Created by IntelliJ IDEA.
  User: Administrator
  Date: 2018/5/3
  Time: 20:05
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>模拟考试</title>

    <link href="${pageContext.request.contextPath}/static/css/bootstrap.min.css" rel="stylesheet">
    <link href="${pageContext.request.contextPath}/static/css/style.min.css" rel="stylesheet">

    <script src="${pageContext.request.contextPath}/static/js/jquery.min.js"></script>
    <script src="${pageContext.request.contextPath}/static/js/bootstrap.min.js"></script>
    <style>
        .numbutton {
            height: 60px;
            width: 70px;
            margin: 15px;
            font-size: 20px;
            font-weight: bold;

            /*background: white;*/
            /*border: solid 1px;*/
        }

        .numbutton2 {
            height: 60px;
            width: 140px;
            margin: 20px;
            font-size: 20px;
            font-weight: bold;

        }
        .form-group{
            margin-top: 20px;
        }
        .btng{
            height: 30px;
            width: 80px;
            font-weight: bold;
            margin-left: 10px;
            margin-right: 10px;
        }
        label,button{
            color: black;
        }
        label{
            font-size: 17px;
            font-weight: 500;
        }
        .container-fluid{
            margin-top: 50px;
        }
    </style>
</head>

<body>
<div class="container-fluid">

    <div class="row">
        <div class="col-md-4 col-md-offset-2" style="background:rgba(164,164,164,0.39);width: 410px;height: 400px">
            <form class="form-horizontal">
                <h3 style="margin-top: 25px;margin-bottom: 25px;color: black">རྒྱུགས་སྤྲོད་སློབ་མ་ཆ་འཕྲིན།:</h3>
                <div class="form-group">
                    <label class="col-sm-4 control-label">སློབ་མའི་མིང།:</label>
                    <div class="col-sm-7">
                        <input type="text" readonly placeholder="xxx" class="form-control" id="username">
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-sm-4  control-label">དཔང་རྟགས་ཀྱི་རིགས་དབྱིབས།:</label>
                    <div class="col-sm-7">
                        <input type="text" readonly placeholder="གྲོང་མི་འི་ཐོབ་ཐང་ལག་ཁྱེར།" class="form-control">
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-sm-4  control-label">དཔང་ཡིག་གི་ཨང་གྲངས།：</label>
                    <div class="col-sm-7">
                        <input id="idcard" type="text" placeholder="" class="form-control" value="">
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-sm-4  control-label">རྒྱུགས་རླངས་འཁོར་རིགས་དབྱིབས།:</label>
                    <div class="col-sm-7">
                        <input type="text" readonly placeholder="c1.c2.c3.c4" class="form-control" id="car">
                    </div>
                </div>
                <div class="form-group">
                    <div class="col-sm-offset-3 col-sm-8">
                        <button class="btng" type="button" onclick="tijaio()">གཏན་ཁེལ།</button>
                        <button class="btng" type="button">ལེན་མེ་གསོད།</button>
                    </div>
                </div>
            </form>
        </div>
        <div class="col-md-4" style="background:rgba(164,164,164,0.39);margin-left: 10px;width: 450px">
            <div>
                <button onclick="add(1)" class="numbutton ">1</button>
                <button onclick="add(2)" class="numbutton ">2</button>
                <button onclick="add(3)" class="numbutton ">3</button>
                <button onclick="add(4)" class="numbutton ">4</button>
                <button onclick="add(5)" class="numbutton ">5</button>
                <button onclick="add(6)" class="numbutton ">6</button>
                <button onclick="add(7)" class="numbutton ">7</button>
                <button onclick="add(8)" class="numbutton ">8</button>
                <button onclick="add(9)" class="numbutton ">9</button>
                <button onclick="add(0)" class="numbutton ">0</button>
                <button onclick="add('x')" class="numbutton">x</button>
                <button  onclick="shanOne()" class="numbutton2">ཕྱིར་ནུར་བྱས།</button>
                <button onclick="rese()" class="numbutton2">བསྐྱར་གཅོད།</button>
            </div>
        </div>
    </div>
</div>

<script>
    var $idc = $("#idcard");
    var courseId;

    function add(key) {
        var pr = $idc.val();
        if(pr.length>18){
            layer.msg("ཐོབ་ཐང་ལག་ཁྱེར་ཆེས་མང་པོ་18གནས།",{icon:2,time:1000});
            return false;
        }
        $idc.val(pr+''+key)
    }
    function shanOne() {
        var pr = $idc.val();
        $idc.val(pr.slice(0,pr.length-1))
    }

    function rese() {
        $idc.val("")
    }
    $(function () {
        var car= getQueryString("text");
        courseId=getQueryString("courseId");
        var username=getQueryString("username");
        $("#username").val(username);
        $("#car").val(car);
    })
    function getQueryString(name) {
        var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i");
        var r = window.location.search.substr(1).match(reg);
        if (r != null) return decodeURI(r[2]); return null;
    }
    //    /**
    //     *  跳转到模拟考试界面
    //     * @author tsl
    //     * @date 2018/4/28 9:52
    //     * @param type 1汉 2藏
    //     * @param courseId 科目id
    //     * @param status 模拟考试 1
    //     * @return
    //     */
    //    @RequestMapping(value = "/test/{type}-{status}-{number}-{courseId}.html",method = RequestMethod.GET)
    function tijaio() {
        window.parent.exportData("/test/2-1-"+$idc.val()+"-"+courseId+".html");
        var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
        parent.layer.close(index);
    }
</script>

</body>
</html>
